No abi3
authorAntonio Valentino <antonio.valentino@tiscali.it>
Sun, 22 Feb 2026 10:53:30 +0000 (10:53 +0000)
committerAntonio Valentino <antonio.valentino@tiscali.it>
Sat, 28 Feb 2026 18:08:45 +0000 (18:08 +0000)
Forwarded: not-needed

Gbp-Pq: Name 0007-No-abi3.patch

setup.py

index b20597150b9765d9fba1cfca5ff0b72f51a66b1a..009ccad9c5e6bc19d2b9a6603d2a283f46ad5e67 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -1073,14 +1073,14 @@ if __name__ == "__main__":
 
     cmdclass = {"build_ext": BuildExtensions}
     compiler_directives = {"freethreading_compatible": True}
-    abi3_macros = []
-    abi3_ext_kwargs = {}
-    abi3_cflags = ""
-    if platform.python_implementation() == "CPython" and not is_freethreaded():
-        abi3_macros.append(("Py_LIMITED_API", "0x030B0000"))  # 3.11
-        abi3_cflags = f"-D{'='.join(abi3_macros[-1])}"
-        abi3_ext_kwargs["py_limited_api"] = True
-        cmdclass["bdist_wheel"] = bdist_wheel_abi3
+    abi3_macros = []
+    abi3_ext_kwargs = {}
+    abi3_cflags = ""
+    if platform.python_implementation() == "CPython" and not is_freethreaded():
+        abi3_macros.append(("Py_LIMITED_API", "0x030B0000"))  # 3.11
+        abi3_cflags = f"-D{'='.join(abi3_macros[-1])}"
+        abi3_ext_kwargs["py_limited_api"] = True
+        cmdclass["bdist_wheel"] = bdist_wheel_abi3
 
     def get_cython_extfiles(extnames):
         extdir = Path("tables")
@@ -1100,13 +1100,13 @@ if __name__ == "__main__":
                 # it would be nice to have an option or something to pass here, but
                 # there doesn't seem to be one according to the docs, so temporarily set
                 # the env var instead
-                orig_cflags = os.getenv("CFLAGS", None)
-                cflags = (
-                    f"{orig_cflags} {abi3_cflags}"
-                    if orig_cflags
-                    else abi3_cflags
-                )
-                os.environ["CFLAGS"] = cflags
+                orig_cflags = os.getenv("CFLAGS", None)
+                cflags = (
+                    f"{orig_cflags} {abi3_cflags}"
+                    if orig_cflags
+                    else abi3_cflags
+                )
+                os.environ["CFLAGS"] = cflags
                 try:
                     cythonize(
                         str(extpfile),
@@ -1114,10 +1114,11 @@ if __name__ == "__main__":
                         language_level="2",
                     )
                 finally:
-                    if orig_cflags is not None:
-                        os.environ["CFLAGS"] = orig_cflags
-                    else:
-                        del os.environ["CFLAGS"]
+                    # if orig_cflags is not None:
+                    #     os.environ["CFLAGS"] = orig_cflags
+                    # else:
+                    #     del os.environ["CFLAGS"]
+                    pass
             extfiles[extname] = extcfile
 
         return extfiles
@@ -1250,8 +1251,8 @@ if __name__ == "__main__":
         "define_macros": def_macros,
         "include_dirs": inc_dirs,
     }
-    def_macros.extend(abi3_macros)
-    extension_kwargs.update(abi3_ext_kwargs)
+    def_macros.extend(abi3_macros)
+    extension_kwargs.update(abi3_ext_kwargs)
 
     extensions = [
         Extension(